<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link href="./static/plugins/bootstrap/bootstrap.min.css" rel="stylesheet">
    <link href="./static/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="./static/css/font-awesome.min.css" rel="stylesheet">
    <link href="./static/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="./static/plugins/blueimp/blueimp-gallery.min.css" rel="stylesheet">
    <link href="./static/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">
    <link href="./static/css/animate.css" rel="stylesheet">
    <link href="./static/css/style.css" rel="stylesheet">

    <script type="text/javascript" src="./static/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="./static/plugins/bootstrap/bootstrap.min.js"></script>
</head>
<body class="fixed-sidebar no-skin-config full-height-layout">
<div id="wrapper" v-cloak>
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <span class="img-thumb"><strong class="font-bold">{{user.company}}</strong></span>
                        <a href="javascript:">
                            <span class="clear">
                                <span class="block m-t-xs"> <strong class="font-bold">{{type[user.type]}}</strong></span>
                            </span>
                        </a>
                    </div>
                </li>
                <li>
                    <a href="/home.html"><i class="fa fa-home"></i> <span class="nav-label">个人中心</span></a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-info-circle"></i> <span class="nav-label">基本信息</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="user.html">个人信息</a></li>
                        <li><a href="verify.html">账号认证</a></li>
                        <li><a href="finance.html">财务明细</a></li>
                        <li v-if="user.is_root>0"><a href="employee.html">员工账号</a></li>
                        <li><a href="pwd.html">修改密码</a></li>
                        <li><a href="address.html">收货地址</a></li>
                    </ul>
                </li>
                <li v-if="user.type!=2" class="active">
                    <a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">询价</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li class="active"><a href="inquiry_list.html">询价单</a></li>
                        <li><a href="enquiry.html">我要询价</a></li>
                    </ul>
                </li>
                <li v-else>
                    <a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">报价</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="inquiry_list_supply.html">未报价</a></li>
                        <li><a href="offer_sheet.html">已报价</a></li>
                    </ul>
                </li>
                <li>
                    <a href="index.html"><i class="fa fa-first-order"></i> <span class="nav-label">订单管理</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="order_list.html">订单列表</a></li>

                    </ul>
                </li>
                <li>
                    <a onclick="logout()"><i class="fa fa-sign-out"></i> <span class="nav-label">退出登录</span></a>
                </li>
            </ul>
        </div>
    </nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-success" href="#"><i class="fa fa-bars"></i> </a>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li class="m-r">
                        <span class="m-r-sm text-danger font-bold welcome-message" id="nav-title">{{user.name}}&nbsp;</span><span>{{user.company}}&nbsp;{{user.zone}}</span>
                    </li>
                    <li class="dropdown m-r">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" aria-expanded="false">
                            <i class="fa fa-bell"></i> <span class="label label-danger" v-if="msgbox.total">{{msgbox.total}}</span>
                        </a>
                        <ul class="dropdown-menu dropdown-alerts">
                            <li v-if="msgbox.daifahuo">
                                <a href="javascript:parent.document.getElementById('main').src='order_list.html?order_status=200'">
                                    <div>
                                        <i class="fa fa-envelope fa-fw"></i> 您有<strong>{{msgbox.daifahuo}}</strong>个待发货订单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daifahuo"></li>
                            <li v-if="msgbox.daifukuan">
                                <a href="javascript:parent.document.getElementById('main').src='order_list.html?order_status=100'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.daifukuan}}</strong>个待付款订单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daifukuan"></li>
                            <li v-if="msgbox.daishouhuo">
                                <a href="javascript:parent.document.getElementById('main').src='order_list.html?order_status=300'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.daishouhuo}}</strong>个订单待收货
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daishouhuo"></li>
                            <li v-if="msgbox.baojiazhong && user.type==1">
                                <a href="javascript:parent.document.getElementById('main').src='inquiry_list.html?status=100'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.baojiazhong}}</strong>个报价中询价单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.baojiazhong && user.type==1"></li>
                            <li v-if="msgbox.daibaojia">
                                <a href="javascript:parent.document.getElementById('main').src='inquiry_list_supply.html'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.daibaojia}}</strong>个待报价询价单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daibaojia"></li>
                            <li v-if="msgbox.weitongguo">
                                <a href="javascript:parent.document.getElementById('main').src='offer_sheet.html'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.weitongguo}}</strong>个报价未通过
                                    </div>
                                </a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a onclick="logout()">
                            <i class="fa fa-sign-out"></i> 安全退出
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="row wrapper border-bottom white-bg p-h-sm">
            <div class="col-md-10">
                <ol class="breadcrumb">
                    <li class="active">
                        <strong>询价单详情</strong>
                    </li>
                </ol>
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight tooltip-demo relative">
            <div class="row">
                <div class="ibox-content m-b-sm border-bottom">
                    <div class="col-sm-1"><a href="inquiry_list.html" class="btn btn-danger btn-outline btn-sm" id="back"><i class="fa fa-mail-reply-all text-5 fa-return"></i>&nbsp;返回</a></div>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div class="step1">
                <!--询价单详情-->
                <div class="row  border-bottom white-bg dashboard-header">
                    <div class="col-md-4">
                        <h2>询价单详情</h2>
                        <small>询价单号: {{inquiry.id}}&nbsp;&nbsp;发布时间: {{inquiry.created_at}}</small>
                        <div class="ibox float-e-margins">
                            <div class="ibox-content no-borders">
                                <table class="table table-hover sumary">
                                    <tbody>
                                    <tr>
                                        <th>询价公司</th>
                                        <td v-if="inquiry.company">{{inquiry.company.name}}&nbsp;( {{inquiry.company.zone}} )</td>
                                    </tr>
                                    <tr>
                                        <th>联系人</th>
                                        <td v-if="inquiry.members">{{inquiry.members.name}}</td>
                                    </tr>
                                    <tr>
                                        <th>联系电话</th>
                                        <td v-if="inquiry.members">{{inquiry.members.phone}}</td>
                                    </tr>
                                    <tr v-if="inquiry.order_type==0">
                                        <th>报案号</th>
                                        <td>{{inquiry.report_number}}</td>
                                    </tr>
                                    <tr>
                                        <th>品牌</th>
                                        <td v-if="inquiry.hasOwnProperty('car_brand')">{{inquiry.car_brand.brand}}</td>
                                    </tr>
                                    <tr>
                                        <th>车型</th>
                                        <td>{{inquiry.car_model}}</td>
                                    </tr>
                                    <tr>
                                        <th>车牌号</th>
                                        <td>{{inquiry.car_number}}</td>
                                    </tr>
                                    <tr>
                                        <th>车架号</th>
                                        <td>{{inquiry.vin_code}}</td>
                                    </tr>
                                    <tr v-if="inquiry.order_type==0">
                                        <th>保险公司</th>
                                        <td>{{inquiry.insurer.name}} ({{inquiry.insurer.zone}})</td>
                                    </tr>
                                    </tbody>
                                </table>
                                <div class="">
                                    询价备注: {{inquiry.remark}}
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-10">
                        <h2>车辆图片</h2>
                        <div class="lightBoxGallery links text-left img-100">
                            <a v-for="(vo,index) in inquiry.car_photos" :href="vo.img"><img :src="vo.img"></a>
                        </div>
                    </div>
                    <div class="col-md-10" v-if="inquiry.form_type>0">
                        <h2>报价图片</h2>
                        <div class="lightBoxGallery links text-left img-100 bj">
                            <a v-for="(vo,index) in inquiry.inquiry_photos" :href="vo.img"><img :src="vo.img"></a>
                        </div>
                    </div>
                    <div class="col-md-10" v-else>
                        <h2>询价配件</h2>
                        <div class="ibox float-e-margins">
                            <div class="ibox-content no-borders">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>编号</th>
                                        <th>名称</th>
                                        <th>OE码</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr v-for="(vo,index) in inquiry.inquiry_forms">
                                        <td>{{index+1}}</td>
                                        <td>{{vo.name}}</td>
                                        <td>{{vo.oecode}}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!--报价-->
                <div class="row ibox-content m-t" v-for="(vo,index) in inquiry.quotes" v-if="vo.status">
                    <h3 class="p-w-m">{{vo.provider.name}}
                        <small class="m-l-lg">联系人:&nbsp;{{vo.members.name}}</small>
                        <small class="m-l-lg">联系电话:&nbsp;{{vo.members.phone}}</small>
                        <small class="m-l-lg">报价时间:&nbsp;{{vo.created_at}}</small>
                    </h3>

                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th width="3%">NO.</th>
                            <th width="17%">名称</th>
                            <th width="8%">OE码</th>
                            <th width="8%" v-for="(vp,idx) in quality">{{vp}}</th>
                            <th width="25%">备注</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(vd,idx) in vo.detail">
                            <td class="text-center">{{idx+1}}</td>
                            <td class="text-center">{{vd.name}}</td>
                            <td class="text-center">{{vd.oecode}}</td>
                            <td v-for="(vpt,idxq) in quality" style="text-align: center">
                                <div class="radio radio-success" v-for="(vp,index_p) in vd.prices" v-if="vpt==vp.quality">
                                    <input :id="'radio'+index+idx+'-'+index_p" :name="'radio'+vo.id+'-'+idx" :value="vp.id" type="radio" v-model="vd.checked" :data-outidx="index" :data-inneridx="idx">
                                    <label :for="'radio'+index+idx+'-'+index_p">
                                        <span>{{vp.price}}</span>
                                    </label>
                                </div>
                            </td>
                            <td class="text-danger">{{vd.remark}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>

                <div class="row ibox-content m-t" v-if="inquiry.audited_quote_num">
                    <div class="col-md-2 col-md-offset-4">
                        <button class="btn btn-block btn-primary" @click="checkSelect()">选择报价</button>
                    </div>
                </div>
            </div>

            <div class="step2" style="display: none;">
                <div class="row ibox-content m-t">
                    <h2>已选零件</h2>
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th>配件商</th>
                                <th>配件</th>
                                <th>OE码</th>
                                <th>品质</th>
                                <th>单价</th>
                                <th>数量</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="(vo,index) in selected">
                                <td class="text-center">{{vo.provider.name}}</td>
                                <td class="text-center">{{vo.name}}</td>
                                <td class="text-center">{{vo.oecode}}</td>
                                <td class="text-center">{{vo.checked_price.quality}}</td>
                                <td class="text-center">{{vo.checked_price.price}}</td>
                                <td width="15%" class="text-center">
                                    <div class="input-group">
                                        <span class="input-group-addon pointer" @click="minus(index)">-</span>
                                        <input type="number" class="form-control input-sm text-center number" v-model="vo.checked_price.num">
                                        <span class="input-group-addon pointer" @click="plus(index)">+</span>
                                    </div>
                                </td>
                                <td class="text-center"><a @click="deleteItem(index)"><i class="fa fa-times text-danger p-xxs"></i></a></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!--订单备注-->
                <div class="row ibox-content m-t">
                    <h2>订单备注</h2>
                    <div class="col-md-6">
                        <textarea class="form-control" v-model="remark" placeholder="请填写订单备注"></textarea>
                    </div>
                </div>
                <!--收货地址-->
                <div class="row ibox-content m-t">
                    <h2>收货地址</h2>
                    <div class="row ibox-content address-box" v-if="address.length">
                        <div :class="['col-md-2 contact-box center-version pointer normal m-r',{active:vo.default==1}]" v-for="(vo,index) in address">
                            <h3>{{vo.name}}</h3>
                            <address>
                                {{vo.city}}<br>
                                {{vo.address}}<br>
                                <abbr title="Phone">P: </abbr>{{vo.phone}}
                            </address>
                        </div>

                        <div class="col-md-2 contact-box center-version pointer add" onclick="$('#addr-modal').modal('show')" title="添加收货地址">
                            <i class="fa fa-plus"></i>
                            <span>添加收货地址</span>
                        </div>
                    </div>
                </div>

                <div class="row ibox-content">
                    <div class="col-md-2 col-md-offset-4" v-show="inquiry.quotes&&inquiry.quotes.length">
                        <button type="button" class="ladda-button btn btn-block btn-primary" @click="submitOrder()">提交订单</button>
                    </div>
                </div>
            </div>

        </div>


        <div class="modal inmodal fade" id="addr-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title">添加收货地址</h4>
                    </div>
                    <div class="modal-body">
                        <div class="ibox-content">
                            <form class="form-horizontal" id="address-form">
                                <div class="form-group"><label class="col-md-2 control-label">收货人</label>
                                    <div class="col-md-10"><input type="text" id="name" class="form-control"></div>
                                </div>
                                <div class="form-group"><label class="col-md-2 control-label">联系电话</label>
                                    <div class="col-md-10"><input type="number" id="phone" class="form-control"></div>
                                </div>
                                <div class="form-group"><label class="col-md-2 control-label">选择城市</label>
                                    <div class="col-md-3">
                                        <select class="form-control" v-model="province">
                                            <option :value="index" v-for="(vo,index) in area">{{vo.name}}</option>
                                        </select>
                                    </div>
                                    <div class="col-md-3">
                                        <select class="form-control" v-model="city">
                                            <option :value="index" v-for="(vo,index) in area[province].sub">{{vo.name}}</option>
                                        </select>
                                    </div>
                                    <div class="col-md-3">
                                        <select class="form-control" v-model="district">
                                            <option :value="index" v-for="(vo,index) in area[province].sub[city].sub">{{vo.name}}</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group"><label class="col-md-2 control-label">详细地址</label>
                                    <div class="col-md-10"><input type="text" id="address" class="form-control"></div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-10 col-md-offset-2">
                                        <div class="checkbox checkbox-success">
                                            <input id="default" type="checkbox">
                                            <label for="default">设为默认地址</label>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="ladda-button btn btn-primary btn-w-m" data-style="expand-right" @click="saveAddress()">保存</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="blueimp-gallery" class="blueimp-gallery">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>
<script type="text/javascript" src="./static/js/cityList.js"></script>
<script type="text/javascript" src="./static/plugins/toastr/toastr.min.js"></script>
<script type="text/javascript" src="./static/plugins/blueimp/jquery.blueimp-gallery.min.js"></script>
<script type="text/javascript" src="./static/plugins/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="./static/plugins/ladda/spin.min.js"></script>
<script type="text/javascript" src="./static/plugins/ladda/ladda.min.js"></script>
<script type="text/javascript" src="./static/plugins/ladda/ladda.jquery.min.js"></script>
<script type="text/javascript" src="./static/js/slimscroll.min.js"></script>
<script type="text/javascript" src="./static/js/metisMenu.js"></script>
<script type="text/javascript" src="./static/js/inspinia.js"></script>
<script type="text/javascript" src="./static/js/vue.min.js"></script>
<script type="text/javascript" src="./static/js/main.js"></script>
<script>
    //0:待发布 100:待报价 200:已选价 300:已完成 400:已取消
    var vm = new Vue({
        el: '#wrapper',
        data: {
            user: {},
            inquiry: {},
            address: [],
            remark: '',
            area: area,
            province: 0,
            city: 0,
            district: 0,
            selected: [],
            type: {"1": "修理厂", "2": "配件商", "3": "保险公司"},
            msgbox: {},
            quality: []
        },
        methods: {
            getData: function (instance) {
                $.ajax({
                    type: 'POST',
                    url: api + 'user/inquiryDetail',
                    data: {id: getUrlParam('id')},
                    success: function (data) {
                        checkToken(data);
                        instance.inquiry = data.data;
                    }
                });
                instance.getAddress(instance);
            },
            getAddress: function (instance) {
                instance = instance ? instance : vm;
                $.ajax({
                    type: 'POST',
                    url: api + 'user/shippingaddr',
                    success: function (data) {
                        if (data.data != '') {
                            instance.address = data.data;
                            setTimeout(function () {
                                $('.address-box .normal').on('click', function () {
                                    $(this).addClass('active').siblings().removeClass('active');
                                });
                            }, 100);
                        }
                    }
                });
            },
            saveAddress: function () {
                var phone = document.getElementById('phone').value;
                if (!checkMobile(phone)) {
                    toastr.warning('联系电话格式不正确');
                    return;
                }
                var param = {
                    name: document.getElementById('name').value,
                    phone: phone,
                    city: vm.area[vm.province].name + ' ' + vm.area[vm.province].sub[vm.city].name + ' ' + vm.area[vm.province].sub[vm.city].sub[vm.district].name,
                    address: document.getElementById('address').value,
                    default: document.getElementById('default').checked ? 1 : 0,
                };
                if (!param.name) {
                    toastr.warning('请填写地址人姓名');
                    return;
                }
                if (!param.address) {
                    toastr.warning('请填写详细收货地址');
                    return;
                }
                var btn = $(event.currentTarget).ladda().ladda('start');
                $.ajax({
                    type: 'POST',
                    url: api + 'user/shippingaddrAdd',
                    data: param,
                    success: function (data) {
                        btn.ladda('stop');
                        if (data.ret == 0) {
                            vm.getAddress();
                            $('#addr-modal').modal('hide');
                            document.getElementById("address-form").reset();
                            vm.province = 0;
                            vm.city = 0;
                            vm.district = 0;
                        } else {
                            toastr.error(data.msg);
                        }
                    }
                });
            },
            minus: function (index) {
                var input = $(event.currentTarget).next();
                if (parseInt(input.val()) > 1) {
                    input.val(parseInt(input.val()) - 1);
                }
                vm.selected[index].checked_price.num = input.val();
            },
            plus: function (index) {
                var input = $(event.currentTarget).prev();
                input.val(parseInt(input.val()) + 1);
                vm.selected[index].checked_price.num = input.val();
            },
            checkSelect: function () {
                vm.selected = [];
                for (var i = 0; vo = vm.inquiry.quotes[i++];) {
                    for (var j = 0; vc = vo.detail[j]; j++) {
                        if (vc.checked > 0) {
                            for (var k = 0; vd = vc.prices[k]; k++) {
                                if (vd.id == vc.checked) {
                                    vd.num = 1;
                                    vc.checked_price = vd;
                                }
                            }
                            vc.provider = vo.provider;
                            vc.quoter = vo.members;
                            vm.$set(vm.selected, vm.selected.length, vc);
                        }
                    }
                }
                if (vm.selected.length == 0) {
                    toastr.warning('请选择报价配件');
                    return;
                }
                $('.step1').slideUp('fast');
                $('.step2').slideDown('fast');
            },
            submitOrder: function () {
                var index = $('.contact-box.active').index();
                if (index < 0) {
                    toastr.error('请选择收货地址');
                    return;
                }
                var btn = $(event.currentTarget).ladda().ladda('start');
                var param = {
                    inquiry: {
                        id: vm.inquiry.id,
                        order_type: vm.inquiry.order_type,
                        form_type: vm.inquiry.form_type,
                        insurer_id: vm.inquiry.insurer_id,
                        report_number: vm.inquiry.report_number,
                        vin_code: vm.inquiry.vin_code,
                        car_number: vm.inquiry.car_number,
                        car_type: vm.inquiry.car_type,
                        car_model: vm.inquiry.car_model,
                        carbrand_id: vm.inquiry.carbrand_id,
                        caricon: vm.inquiry.caricon,
                    },
                    shippingAddr: vm.address[index],
                    selected: vm.selected,
                    remark: vm.remark
                };
                param.selected.forEach(function (v, i) {
                    delete param.selected[i]['prices'];
                    delete param.selected[i]['provider']['type'];
                    delete param.selected[i]['provider']['province'];
                    delete param.selected[i]['provider']['city'];
                    delete param.selected[i]['provider']['tel'];
                    delete param.selected[i]['provider']['logo'];
                    delete param.selected[i]['provider']['address'];
                    delete param.selected[i]['provider']['description'];
                    delete param.selected[i]['provider']['license_img'];
                    delete param.selected[i]['provider']['license_no'];
                    delete param.selected[i]['provider']['authstatus'];
                    delete param.selected[i]['provider']['authreason'];
                    delete param.selected[i]['provider']['account'];
                    delete param.selected[i]['provider']['frozen'];
                    delete param.selected[i]['provider']['usemoney'];
                    delete param.selected[i]['provider']['sortorder'];
                    delete param.selected[i]['provider']['created_at'];
                    delete param.selected[i]['provider']['updated_at'];
                });
                $.ajax({
                    type: 'POST',
                    url: api + 'user/submitOrder',
                    data: param,
                    success: function (data) {
                        btn.ladda('stop');
                        checkToken(data);
                        if (data.ret == 0) {
                            location.href = 'pay.html?order_no=' + data.data.order_no;
                        }
                    }
                });
            },
            deleteItem: function (index) {
                vm.selected.splice(index, 1);
            }
        },
        created: function () {
            this.user = getItem('info');
            this.getData(this);
            var self = this;
            $.ajax({
                type: 'POST',
                url: api + 'user/msgNum',
                dataType: 'json',
                success: function (data) {
                    if (data.ret == 0) {
                        self.msgbox = data.data;
                    }
                },
            });
            $.ajax({
                type: 'POST',
                url: api + 'index/quality',
                success: function (data) {
                    self.quality = data.data;
                }
            });
        },
        mounted: function () {
            var instance = this;
            setTimeout(function () {
                $('.links').on('click', function (event) {
                    event = event || window.event;
                    var target = event.target || event.srcElement,
                        link = target.src ? target.parentNode : target,
                        options = {index: link, event: event},
                        links = this.getElementsByTagName('a');
                    blueimp.Gallery(links, options);
                });

                $('.radio input[type="radio"]').on('click', function () {
                    var obj = this;
                    var ischeck = obj.dataset.ischeck;
                    var checkedbrowser = document.getElementsByName(obj.name);
                    var len = checkedbrowser.length;
                    if (ischeck == 1) {
                        for (var i = 0; i < len; i++) {
                            checkedbrowser[i].checked = false;
                            instance.inquiry.quotes[checkedbrowser[i].dataset.outidx].detail[checkedbrowser[i].dataset.inneridx].checked = 0;
                            checkedbrowser[i].removeAttribute('data-ischeck');
                        }
                    } else {
                        for (var j = 0; j < len; j++) {
                            if (obj == checkedbrowser[j]) {
                                obj.dataset.ischeck = 1;
                            } else {
                                checkedbrowser[j].removeAttribute('data-ischeck');
                            }
                        }
                    }
                });
            }, 250);
        }
    });

</script>
</body>
</html>
